home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
pcboard
/
msgtag11.zip
/
READ.PPS
< prev
next >
Wrap
Text File
|
1996-01-30
|
11KB
|
353 lines
; READ.PPE - Written by Dan Shore - SysOp
; The Shoreline BBS
;──────────────────────────────────────────────────────────────────────────────
;
; Revised on : 11/01/95
; Revised by : Dan Shore
; Purpose : To let user choose which set of 20 tagged messages to
; read instead of *forcing* only the first 20. Three new
; subroutines added: DISPLAY_MSG_SETS, GET_NEXT_VALUE
; PROCESSED_TAGGED
;
;──────────────────────────────────────────────────────────────────────────────
;
; To be used with Msg Tagging PPE (QSCAN, MEC, MORE, READ, RECOVER, KILL)
;
; 1) Edit your CMD.LST file(s) to add this:
;
; Charges Per PPE/MNU File Specification -or-
; Command Sec Minute Use Keystroke Substitution
; ══════════════ ═══ ═════════════════ ═════════════════════════════════
; 1) R 5 0 0 C:\PCB\PPE\READ\READ.PPE
;
; Note: You may have to change the pathname to the PPE.
;
;──────────────────────────────────────────────────────────────────────────────
STRING main_prompt ' Common prompt display variable
STRING tag_msg_file ' File that contains tagged msgs
STRING hold ' Generic string variable
STRING hold2 ' Garbage variable
STRING start_msg_num ' Starting msg number when reading a set
STRING end_msg_num ' Ending msg number when reading a set
BIGSTR user_input_temp ' Temp variable for parsing information
BIGSTR user_input ' Common user input variable - used with tagged msgs
BIGSTR temp ' Generic string variable - used for reading tag list
INT cmd_line_count ' Count number of command line parms
INT x ' Generic int variable
INT msg_num_count ' Number of tagged messages
INT set_number ' 20 Msg number set
;──────────────────────────────────────────────────────────────────────────────
cmd_line_count = TOKCOUNT()
IF (cmd_line_count) THEN
'
' Get path to swap file directory
'
hold = READLINE(PCBDAT(),204)
hold = FILEINF(hold,6) + ":" + FILEINF(hold,7)
'
' Determine paths and names of files used by READ.PPE
'
tag_msg_file = hold + "mtg" + STRING(CURCONF()) + ".lst"
'
' Process command line (stacked) commands
'
hold = ""
FOR x = 1 TO cmd_line_count
hold = hold + UPPER(GETTOKEN()) + ";"
NEXT
'
' If user did not enter TAG, stuff the keyboard with their input
'
IF (!INSTR(hold,"TAG")) THEN
KBDSTUFF "R;" + hold + CHR(13)
GOTO EXIT_PROG
'
' Get the list of tagged msgs and process
'
ELSE
GOTO UNTAG_MSGS
END IF
END IF
'
' No commands stacked after the "R"ead command
'
IF (EXIST(PPEPATH()+"read")) DISPFILE PPEPATH()+"read", LANG+GRAPH
PRINT "@X0BYou are currently in Conference: @X0A@CONFNAME@ @X07[@X0F@CONFNUM@@X07]"
NEWLINE
'
' If we have tagged msgs, display a special prompt otherwise just stuff
' the "R"ead command alone back to PCB.
'
IF (EXIST(tag_msg_file)) THEN
IF (FILEINF(tag_msg_file,4) > 0) THEN
user_input = ""
hold = STRING(LOMSGNUM()) + "-" + STRING(HIMSGNUM())
main_prompt = "@X02[@X0FH@X02]elp,@X02(@X0F" + hold + "@X02),@X02(@X0FTAG@X02)=@X03@X0BTagged @X03Msgs, @X0EEnter your message command"
INPUTSTR main_prompt, user_input, @X0E, 250, MASK_ASCII(), UPCASE+LFAFTER
IF (user_input = "") GOTO EXIT_PROG
IF (user_input = "TAG") GOTO UNTAG_MSGS
ELSE
DELETE tag_msg_file
END IF
END IF
KBDSTUFF "R " + CHR(13)
GOTO EXIT_PROG
'
' Read the disk file that has the tagged msg and stuff the keyboard with
' the read command and the msg numbers.
'
:UNTAG_MSGS
'
' Read tagged messages from disk file MTG?.LST
'
GOSUB PROCESS_TAGGED
'
' See how many tokens there are. Remember that TOKCOUNT will only
' report the number of tokens it finds up to the 256th character
' in the string user_input.
'
' It will be able to report more than 20 tokens even if the
' message numbers are 9 characters long.
'
' 9 characters for msg number, 1 char for semi-colon = 10 chars
' 256 characters / 10 = 25.6 msg numbers
'
TOKENIZE user_input
msg_num_count = TOKCOUNT()
IF (msg_num_count > 20) THEN
'
' Display to the user the SETS of 20 tagged messages
'
GOSUB DISPLAY_MSG_SETS
'
' Prompt the user which SET of msgs they wish to read
'
hold = ""
main_prompt = " @X0BChoose set number to read @X0E(Enter=quit)@X07"
INPUTSTR main_prompt, hold, @X0E, 2, MASK_NUM(), LFAFTER+GUIDE+FIELDLEN
IF (hold != "") THEN
'
' temp is a string variable that contains the starting and ending
' message numbers of each set. We read this variable and once
' we get the starting and ending numbers, we can get the whole
' range of numbers (20) from the variable user_input. user_input
' contains ALL the tagged message numbers.
'
TOKENIZE temp
FOR x = 1 to set_number
'
' Retrieve first set of staring and ending message numbers
'
hold2 = GETTOKEN()
'
' See if the loop count matches the users input for set to read
'
IF (x = TOINT(hold)) THEN
'
' Get starting and ending message number
'
start_msg_num = MID(hold2,1,INSTR(hold2,",")-1)
end_msg_num = MID(hold2,INSTR(hold2,",")+1, LEN(hold2)-INSTR(hold2,","))
'
' Get set of 20 message numbers from user_input and put
' range in user_input. Break out of FOR loop so we can
' stuff the keyboard user_input
'
user_input = MID(user_input, INSTR(user_input, start_msg_num), INSTR(user_input, end_msg_num) - INSTR(user_input, start_msg_num) + LEN(end_msg_num))
BREAK
END IF
NEXT
'
' User hit CR to the Message command prompt
'
ELSE
user_input = ""
END IF
END IF
'
' Stuff keyboard with user_input. (message numbers to read or nothing)
'
KBDSTUFF CHR(13) + "R;" + user_input + CHR(13)
END
IF (user_input != "") KBDSTUFF "R;" + user_input
:EXIT_PROG
END
'
' Read the tagged files (disk file) into user_input
'
:PROCESS_TAGGED
FOPEN 1, tag_msg_file, O_RD, S_DN
FREAD 1, user_input, FILEINF(tag_msg_file,4)
FCLOSE 1
RETURN
'
'
'
:DISPLAY_MSG_SETS
'
' Display information screen so user knows what is happening
'
PRINTLN
PRINTLN "@X0E┌──────────────────────────────────────────────────────────────┐"
PRINTLN "│@X0BDue to a limitation of PCBoard, only 20 Message numbers can be@X0E│"
PRINTLN "│@X0Bstacked to read at one time. Pick the @X0DSET NUMBER@X0B of tagged @X0E│"
PRINTLN "│@X0Bmessages you wish to read. @X0E│"
PRINTLN "@X0E└──────────────────────────────────────────────────────────────┘"
PRINTLN
'
' Display our set number heading
'
PRINTLN "@X0FSet # @X0CTagged Message Numbers@X07"
PRINTLN "@X0A───── ────────────────────────────────────────────────────────"
'
' Start our set number at 1, and start the set number display of msg #'s
'
set_number = 1
PRINT SPACE(3-LEN(STRING(set_number))), "@X0F", set_number, SPACE(4)
'
' Initialize variables to starting values
'
' x = the number of message numbers we have printed to the screen
'
' temp is a string variable that contains the starting and ending
' message numbers of each set and has the format of:
'
' start,end;start,end;start,end;
'
x = 0
temp = ""
'
' Place user_input value into user_input_temp so we can parse it
' and not destroy the contents of user_input which we will need once
' the user decides which set to read.
'
user_input_temp = user_input
'
' Process our first number, print it to the screen, and add the
' staring number for this set to temp variable. Increment the
' number of message numbers printed to screen (x)
'
GOSUB GET_NEXT_VALUE
PRINT "@X02", hold, " "
temp = hold + ","
INC x
'
' Process the remaining numbers
'
WHILE (1) DO
'
' If we have reached our 20th message number, do this section
'
IF (x = 20) THEN
'
' If 20th number, add ending number to temp variable,
' and set the number of messages printed to the screen
' to 0 in prepartion for displaying next set.
'
temp = temp + hold + ";"
x = 0
PRINTLN
PRINTLN
'
' Get our next message number
'
GOSUB GET_NEXT_VALUE
'
' If no more message numbers (hold = ""), then break out of WHILE loop
'
IF (hold = "") THEN
temp = temp + hold2 + ";"
BREAK
END IF
'
' Print next set number since we have more message numbers to process
'
INC set_number
PRINT SPACE(3-LEN(STRING(set_number))), "@X0F",set_number, SPACE(4)
'
' Process our first number of the next set, print it to the screen, and
' add the starting number for this set to temp variable. Increment the
' number of message numbers printed to screen (x), and increment the
' set number
'
PRINT "@X02", hold, " "
temp = temp + hold + ","
INC x
'
' Go back to the WHILE statement as we have processed our 20th msg
' number and we do not want to process command below this
'
CONTINUE
'
' If we have reached our 10th message number, go to the next line
' on the screen and print 7 spaces for lining up of message numbers
' in two rows of ten numbers each
'
ELSE IF (x = 10) THEN
PRINTLN
PRINT SPACE(7)
END IF
'
' Process the next number and display it on the screen
'
GOSUB GET_NEXT_VALUE
'
' If no more message numbers (hold = ""), then break out of WHILE loop
'
IF (hold = "") THEN
temp = temp + hold2 + ";"
NEWLINES 2
BREAK
END IF
'
' Print the message number to the screen
'
PRINT "@X02", hold, " "
INC x
hold2 = hold
END WHILE
RETURN
'
' This routine was written due to GETOKEN not being able to parse past
' the 256th character of a string. Reported to CDC on 11/1/95
'
' hold is the variable that contains the next value
' parsed from the user_input_temp variable
'
:GET_NEXT_VALUE
hold = MID(user_input_temp, 1, INSTR(user_input_temp, ";")-1)
user_input_temp = MID(user_input_temp, INSTR(user_input_temp, ";")+1, LEN(user_input_temp)-INSTR(user_input_temp,";"))
RETURN